/**
 * Copyright (c) Software Institute of PKU
 * All rights reserved. 
 * This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 */
package edu.pku.sei.modeler.figures;

import java.util.ArrayList;
import java.util.List;

import org.eclipse.draw2d.Graphics;
import org.eclipse.draw2d.ColorConstants;
import org.eclipse.draw2d.CompoundBorder;
import org.eclipse.draw2d.Figure;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.LineBorder;
import org.eclipse.draw2d.MarginBorder;
import org.eclipse.draw2d.ToolbarLayout;
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.draw2d.XYLayout;
import org.eclipse.swt.graphics.Color;

import edu.pku.sei.modeler.figures.CommonFigure;
import edu.pku.notation.runtime.draw2d.*;
import edu.pku.notation.runtime.layout.*;

/**
 * @generated
 *
 */
public class ForkNodeFigure extends CommonFigure {
	public static final org.eclipse.swt.graphics.Color FORKNODE_COLOR = new Color(null,175,178,239);
	public IFigure root = null;
	private IFigure toolTip;
	
	public ForkNodeFigure(){
		
		super();
		XYLayout xyL = new XYLayout();
		setLayoutManager(xyL);
		setOpaque(true);
		
		root = new RectangleFigure();
		root.setBackgroundColor(ColorConstants.buttonDarkest);
		root.setForegroundColor(ColorConstants.black);
		root.setOpaque(true);
		add(root);
		
//		IFigure f = null;
//		IFigure parent = null;
//		XYLayout layout = new XYLayout();
//		setLayoutManager(layout);
//		List parentList = new ArrayList<IFigure>();
//		parentList.add(this);
//		
//		f = new RectangleFigure();
//		parent = (IFigure)parentList.get(0);
//		parent.add(f);
//		f.setBackgroundColor(new org.eclipse.swt.graphics.Color(null, 80, 80, 80));
//		f.setForegroundColor(new org.eclipse.swt.graphics.Color(null, 0, 0, 0));
//		f.setBounds(new Rectangle(114, 86, 14, 132));
//		
//		f.setLayoutManager(new FlowLayout());
//		parentList.add(f);
//		
//		if(parentList.size()>1)
//		{
//			root = (IFigure)parentList.get(1);
//			root.setBounds(new Rectangle(0,0,root.getBounds().width, root.getBounds().height));
//		}
//		
//		
		
		toolTip = new Label("Fork");
		setToolTip(toolTip);
	}
	
	public void setBounds(Rectangle rect) {
		super.setBounds(rect);
		if (root != null)
			root.setSize(rect.width, rect.height);
	}
	protected void paintShadow(Graphics g) {
		// TODO: draw the figure's own shadow here
	}
}
